import { getUserRole } from "@/utils/userToken";

export default {
  inserted(el, binding, vnode) {
    const { value } = binding;
    console.log('value', value)
    let permission = getUserRole() ? getUserRole() : '';
    console.log('permission', permission)
    if (value) {
      const hasPermission = value.includes(permission);
      if (!hasPermission) {
        el.parentNode && el.parentNode.removeChild(el);
      }
    } else {
      throw new Error(`need single url! `);
    }
  }
};
